<?
	class get_articles
	{
		private $idWeb;
		private $title;
		private $short;
		private $content;
		private $dateupdate;
		
		function getidWeb()			{return $this->idWeb;}
		function setidWeb($value)	{$this->idWeb=$value;}
		
		function gettitle()			{return $this->title;}
		function settitle($value)	{$this->title=$value;}
		
		function getshort()			{return $this->short;}
		function setshort($value)	{$this->short=$value;}
		
		function getcontent()		{return $this->content;}
		function setcontent($value)	{$this->content=$value;}
		
		function getdateupdate()		{return $this->dateupdate;}
		function setdateupdate($value)	{$this->dateupdate=$value;}		
		
		function removeBot($html){}
		function get_articles()	{}
		
		function SaveLinkInputData($arrLink){
			global $db, $FullUrl, $lg, $stack;
			$tableInsert = 'get_articles';
			$len = count($arrLink);
			
			for($i = 0; $i < $len; $i++){
				$unique_key = CreateUniqueKey($arrLink[$i]['title']);	
				if(CheckUniqueKeyVN($unique_key) == 0){
					$arr['cid'] = $arrLink[$i]['cid'];
					$arr['link_href'] = $arrLink[$i]['link'];
					$arr['name_vn'] = $arrLink[$i]['title'];
					$arr['short_vn'] = $arrLink[$i]['short'];
					$arr['unique_key_vn'] = $unique_key;			
					$arr['status'] = '3';
					$arr['stack'] = $stack;					
					vaInsert($tableInsert, $arr);
				}
				else{
					if(CheckLinkHref($arrLink[$i]['link']) == 0){
						$arr['cid'] = $arrLink[$i]['cid'];
						$arr['link_href'] = $arrLink[$i]['link'];
						$arr['name_vn'] = $arrLink[$i]['title'];
						$arr['short_vn'] = $arrLink[$i]['short'];
						$arr['unique_key_vn'] = $unique_key.'-2';			
						$arr['status'] = '3';
						$arr['stack'] = $stack;						
						vaInsert($tableInsert, $arr);
					}
				}				
			}			
			$msg="Get Link Form Web Complete.";				
		}
		function CheckLinkHref($link)
		{
				global $db, $table_edit, $lg;
				$sql = "SELECT * FROM `get_articles` where link_href = '". $link."'";
				
				$arrRS = $db->getRow($sql);
				
				if($arrRS['link_href'] == $link)
				{			
					return 1;	
				}
				
				return 0;
		}
		function CheckUniqueKeyVN($unique_key)
		{
				global $db, $table_edit, $lg;
				$sql = "SELECT * FROM `get_articles` where unique_key_vn = '". $unique_key."'";
				
				$arrRS = $db->getRow($sql);
				
				if($arrRS['unique_key_vn'] == $unique_key)
				{			
					return 1;	
				}
				
				return 0;
		}
	// End Class	
	}
?>